package com.neusoft.tijian.controller;

import com.neusoft.tijian.aop.Log;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import com.neusoft.tijian.po.Users;
import com.neusoft.tijian.service.UsersService;

@RestController
@RequestMapping("/users")
public class UsersController {

	@Autowired
	private UsersService usersService;

	/**
	 * 用户登录
	 * @param users
	 * @return
	 */
	@Log
	@RequestMapping("/getUsersByUserIdByPass")
	public Users getUsersByUserIdByPass(@RequestBody Users users) {
		return usersService.getUsersByUserIdByPass(users);
	}

	/**
	 * 注册时,查询用户是否(已存在).用户id就是手机号
	 * @param users
	 * @return
	 */
	@RequestMapping("/getUsersById")
	public Users getUsersById(@RequestBody Users users) {
		return usersService.getUsersById(users.getUserId());
	}

	/**
	 * 注册，保存用户信息
	 * @param users
	 * @return
	 */
//	@Log
	@RequestMapping("/saveUsers")
	public int saveUsers(@RequestBody Users users) {
		return usersService.saveUsers(users);
	}
}
